"use strict";
var vue_class_component_1 = VueClassComponent;
function ComponentDefineDecorator(options) {
    return function (target) {
        var defineDescriptor = [];
        if (options.define || options.name) {
            defineDescriptor.push(options.define || options.name);
            delete options.define;
        }
        var depends = [];
        if (options.components) {
            for (var key in options.components) {
                if (typeof options.components[key] === 'string') {
                    depends.push(options.components[key]);
                    options.components[key] = depends.length;
                }
            }
        }
        if (depends.length) {
            defineDescriptor.push(depends, function () {
                var args = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    args[_i] = arguments[_i];
                }
                for (var key in options.components) {
                    if (typeof options.components[key] === 'number') {
                        options.components[key] = args[options.components[key]];
                    }
                }
                return vue_class_component_1["default"](options)(target);
            });
        }
        else {
            if (!!defineDescriptor.length) {
                defineDescriptor.push(function () { return vue_class_component_1["default"](options)(target); });
            }
            else {
                return vue_class_component_1["default"](options)(target);
            }
        }
        return Midware.componentDefine.apply(Midware, defineDescriptor);
    };
}
